package com.example.suntest.service;

import com.example.suntest.entity.User;
import com.example.suntest.enums.PushDownConvertStrategy;
import com.example.suntest.service2.PushDownConverter;

import java.util.ArrayList;
import java.util.List;

/**
 * @version 1.0
 * @Package: com.example.suntest.service
 * @ClassName: Main
 * @Author: sgq
 * @Date: 2024/7/10 16:50
 * @Description: TODD
 */
public class Main {

    public static void main(String[] args) throws Exception {

//        Class<?> forName = Class.forName("com.example.suntest.service2.UserToUserDTOPushDownConverter");
//        PushDownConverter<Object, Object> converter = PushDownConverterFactory.getConverter(PushDownConvertStrategy.USER_TO_USER_DTO);

//        PushDownConverter<Object, Object> converter = PushDownConvertStrategy.USER_TO_USER_DTO.getConverter();
//        PushDownConverter<Object, Object> converter = PushDownConvertStrategy.USER_TO_USER_DTO.getConverter();
//        User user = new User();
//        user.setId(1);
//        user.setName("kelvin");
//        user.setPassword("123456");
//        UserDTO userDTO = (UserDTO) converter.convert(user);
//        System.out.println(user);
//        System.out.println(userDTO);


//        PushDownConverter<Object, Object> converter = PushDownConvertStrategy.USER_TO_USER_VO.getConverter();
//        User user = new User();
//        user.setId(1);
//        user.setName("kelvin");
//        user.setPassword("123456");
//        UserVO userVO = (UserVO) converter.convert(user);
//        System.out.println(user);
//        System.out.println(userVO);

        PushDownConverter<Object, Object> converter = PushDownConvertStrategy.USER_TO_USER_VO.getConverter();
        List<User> userArrayList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            User user = new User();
            user.setId(i+1);
            user.setName("kelvin-"+1);
            user.setPassword("123456-"+1);
            userArrayList.add(user);
        }
//        List<UserDTO> userDtolList =converter.batchConvert(userArrayList);


    }
}
